<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>忘记密码</title>
</head>
<body>

	<form action="/Home/User/doforget" method="post" onsubmit="return false;" id="form">
		账号:<input type="text" name="username" value="" id="uname"><br><br>
		验证码:<input type="text" name="code" id="num" value=""><br><br>
		<img src="/Home/User/code" id="code" onclick="this.src=this.src+'?'"><br><br>
		<button id="btn">提交</button>
		<!-- <?php echo $code = session('code'); ?> -->
		<!-- <a href="#" onclick="document.getElementById('code').src='/Home/User/code'">看不清楚，刷新</a> -->

	</form>
</body>
</html>
<script type="text/javascript" src="/Public/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript">
$('#btn').on('click',function(){
	var uname = $('#uname').val();
	var num = $('#num').val();
	if(uname == '')
	{
		alert('账号不能为空');
	}
	if(num == '')
	{
		alert('请填写验证码!');
	}
	var url = '/Home/User/doforget';
	var data = {'username':uname,'code':num};
	// alert(1111);

	$.post(url,data,function(res){
		if(res.status == 3)
		{
			alert(res.content);
		}else if(res.status == 0){
			alert(res.content);
		}else if(res.status == 2){
			alert(res.content);
		}else if(res.status == 1){
			location.href = res.url;
		}
	},'json');
		
});
</script>